﻿using System.Data.Entity.ModelConfiguration;
namespace wh40klbModel.ModelConfiguration
{
    class VehiculeWargearUtilisationConfiguration:EntityTypeConfiguration<VehiculeWargearUtilisation>
    {
        public VehiculeWargearUtilisationConfiguration()
        {
            //Cle Primaire et table
            HasKey(vwu => new { vwu.VehiculeId, vwu.WargearId });
            //Propriete
            Property(vwu => vwu.MaximumUtilisation).IsRequired();
            Property(vwu => vwu.MinimumUtilisation).IsRequired();
            Property(vwu => vwu.Ratio).IsRequired();
            Property(vwu => vwu.UnitaryCost).IsRequired();
            //cle etrangere
            HasRequired(vwu => vwu.Vehicule).WithMany(i => i.Wargears);
            HasRequired(vwu => vwu.Wargear).WithMany(w => w.Vehicules);
        }
    }
}
